function network_errors = network_dimensioning( input, output, iterations ,cycles, granularity )
% NETWORK DIMENSIONIG : This function iterates to find the best net
% dimension
% INPUT :    input matrix tu be used as net input
%           output vector used as network desired output
%           number of iteration 
%           cycles number of cycle to iterate
%           granularity number of hidden layer to increase for each
%           iteration
%  OUTPUT : vector where elements represent the perfermonces of network
%            trained whith different number of neurons in the hidden layer

%FIRST : CREATE OUTPUT VECTOR 
network_errors = zeros(iterations,cycles);

%SECOND : ITERATION 
%        1. Create and train the network withe the temp input
%        2. Save network performance in the output at index i

for j=1:iterations,
    for i=1:cycles,
    fprintf(' Training network with %d neurons \n', i*granularity);
    [temp_net, performance ] = create_fit_net(input',output',i*granularity);
    fprintf('Iteration %d -> MSE for %d neurons = %f \n', j, i*granularity, performance);
    network_errors(j,i) = performance;
    end
end